package com.baidu.dao;

import com.baidu.entity.MenuBean;
import com.baidu.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.Connection;
import java.util.List;

/**
 * 创作时间：2019/9/19 8:41
 * 作者：李增强
 */
public class MenuDao {
    JDBCUtils ju = new JDBCUtils();
    Connection conn = ju.getConn();
    QueryRunner ru = new QueryRunner();
    public List<MenuBean> getMenuList() {
        String sql="select * from t_menu";
        try {
            return ru.query(conn, sql,new BeanListHandler<MenuBean>(MenuBean.class));
        }catch (Exception e){
            e.printStackTrace();;
        }finally {
            ju.closeJDBC(conn);
        }
        return null;
    }
}
